Arrows, Robots, and Functional Reactive Programming
نویسندگان
چکیده
Functional reactive programming, or FRP, is a paradigm for programming hybrid systems – i.e., systems containing a combination of both continuous and discrete components – in a high-level, declarative way. The key ideas in FRP are its notions of continuous, time-varying values, and time-ordered sequences of discrete events. Yampa is an instantiation of FRP as a domain-specific language embedded in Haskell. This paper describes Yampa in detail, and shows how it can be used to program a particular kind of hybrid system: a mobile robot. Because performance is critical in robotic programming, Yampa uses arrows (a generalization of monads) to create a disciplined style of programming with time-varying values that helps ensure that common kinds of timeand space-leaks do not occur. No previous experience with robots is expected of the reader, although a basic understanding of physics and calculus is assumed. No knowledge of arrows is required either, although we assume a good working knowledge of Haskell. This paper is dedicated in memory of Edsger W. Dijkstra for his influential insight that mathematical logic is and must be the basis for sensible computer program construction.
منابع مشابه
Dance: A Declarative Language for the Control of Humanoid Robots
Robots are becoming increasingly common in, and important to, many commercial, industrial, and military applications. This paper focuses on how to program humanoid robots, and in particular how to program their movements and interactions as easily and as effectively as possible. The core of this effort is the design of a domain-specific language called Dance that is highly abstract, easy to use...
متن کاملCausal commutative arrows revisited Causal commutative arrows revisited
Causal commutative arrows (CCA) extend arrows with additional constructs and laws that make them suitable for modelling domains such as functional reactive programming, differential equations and synchronous dataflow. Earlier work has revealed that a syntactic transformation of CCA computations into normal form can result in significant performance improvements, sometimes increasing the speed o...
متن کاملEffects, Asynchrony, and Choice in Arrowized Functional Reactive Programming
Functional reactive programming facilitates programming with time-varying data that can be perceived as streams flowing through time. Thus, one can think of FRP as an inversion of flow control from the structure of the program to the structure of the data itself. In a typical (say, imperative) program, the structure of the program governs how the program will behave over time; as time moves for...
متن کاملPlugging a Space Leak with an Arrow
The implementation of conceptually continuous signals in functional reactive programming (FRP) is studied in detail. We show that recursive signals in standard implementations using streams and continuations lead to potentially serious time and space leaks under conventional call-by-need evaluation. However, by moving to the level of signal functions, and structuring the design around arrows, t...
متن کاملCategorical semantics for arrows
Arrows are an extension of the well-established notion of a monad in functional programming languages. This article presents several examples and constructions, and develops denotational semantics of arrows as monoids in categories of bifunctors C×C→ C. Observing similarities to monads – which are monoids in categories of endofunctors C→ C – it then considers Eilenberg-Moore and Kleisli constru...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2002